import request from '@/config/axios'

export type DictDataVO = {
  id?: number
  label: string
  value: string
  dictType?: string
  status: number
  colorType: string
  cssClass: string
  remark: string
  sort?: number
  createTime?: string
}

export const getDictDataSimpleList = async (dictType?: string) => {
  return await request.get({ url: '/system/dict-data/simple-list', params: { dictType } })
}

export const getDictDataPage = async (params: PageParam) => {
  return await request.get({ url: '/system/dict-data/page', params })
}

export const getDictData = async (id: number) => {
  return await request.get({ url: '/system/dict-data/get', params: { id } })
}

export const createDictData = async (data: DictDataVO) => {
  return await request.post({ url: '/system/dict-data/create', data: data })
}

export const updateDictData = async (data: DictDataVO) => {
  return await request.post({ url: '/system/dict-data/update', data: data })
}

export const deleteDictData = async (id: number) => {
  return await request.delete({ url: '/system/dict-data/delete', params: { id } })
}

export const exportDictData = async (params: any) => {
  return await request.download({ url: '/system/dict-data/export', params })
}
